{% extends 'CHOMPSGIBundle:Seguridad:base.html.twig' %}
{% block subtitle %} Nuevo{% endblock %} 


{% block content %} 

	{{ parent() }}
	<div class="row-fluid"> 
		<h1>Nuevo Permiso</h1>

			{{ form_start(form, {attr: {novalidate: 'novalidate'}}) }}

					{{ form_row(form.empresa) }}
					
					{{ form_row(form.accion) }}

					{{ form_row(form.objeto) }}

					{{ form_row(form.campo) }}
					

					{{ form_widget(form.save, { 'attr': {'class': 'btn btn-success pull-left'} }) }}

			{{ form_end(form) }}
		
	</div>

	 <script>
	 	activarActionsTab('permisos');  
		
		$campoSelect = 'chomp_sgibundle_permisoChomp_campo';
		$objetoSelect = 'chomp_sgibundle_permisoChomp_objeto';

		hideParentDiv($campoSelect);

		$('#'+$objetoSelect).change(function () {
				console.log('objeto changed');
				var str = '';
				$( '#'+$objetoSelect+' option:selected' ).each(function() {
						if ( $(this).text() == 'Incidentes' ){
							console.log('incidentes selected');
							showParentDiv($campoSelect);
						}else{
							console.log('incidentes not selected');
							hideParentDiv($campoSelect);
						}
					});
			});
	 </script>

{% endblock %}
 